package code.lewdy.app.passport;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

/**
 * 验证问题工具类
 * @author liuding,2012-4-26
 *
 * $LastChangedDate$
 * $Author$ 
 */
public class QuestionUtil
{
    private static Map<Integer, String> m = new HashMap<Integer, String>();
    private static boolean init = false;
    
    public static String getQuestion(int id){
        if(!init)
            init();
        return m.get(id);
    }
    
    private static void init(){
        m.put(1, "您母亲的姓名是?");
        m.put(2, "您配偶的生日是?");
        m.put(3, "您母亲的学号(或工号)是?");
        m.put(4, "您母亲的生日是?");
        m.put(5, "您高中班主任的名字是?");
        m.put(6, "您父亲的姓名是?");
        m.put(7, "您小学班主任的名字是?");
        m.put(8, "您父亲的生日是?");
        m.put(9, "您配偶的姓名是?");
        m.put(10, "您初中班主任的名字是?");
        m.put(11, "您最熟悉的童年好友名字是?");
        m.put(12, "您最熟悉的学校宿舍室友名字是?");
        m.put(13, "对您影响最大的人名字是?");
        init = true;
    }
    public static List<Question> getQuestions(){
        if(!init)
            init();
        List<Question> questions = new ArrayList<Question>();
        Iterator<Integer> iterator = m.keySet().iterator();
        int key = 1;
        while(iterator.hasNext()){
            key = iterator.next();
            if(m.get(key) != null){
                Question q = new Question();
                q.setId(key);
                q.setContent(m.get(key));
                questions.add(q);
            }
        }
        return questions;
    }
    
    public static void main(String[] args)
    {
        System.out.println(QuestionUtil.getQuestions().get(0).getContent());
    }
    
}
